package com.example.demo.Controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("/User")
public class UserController {
    @Value("${server.port}")
    String port;

    @Value("${myuser.descript}")
    private String descript;

    @GetMapping("/hello")
    public ModelAndView gethello()
    {
        System.out.println(descript);
        ModelAndView mv=new ModelAndView();
        mv.addObject("hello",descript);
        mv.setViewName("BookList");
        return mv;
    }

    @GetMapping("/getuser")
    public String getuser()
    {
        int cont=0;
        System.out.println(descript);
        System.out.println("在application中配置的端口号为："+port);
        return "已在控制台输出";
    }
}
